import uicls
import uiutil
import uiconst
import trinity
import blue

class OldFill(uicls.Sprite):
    __guid__ = 'uicls.OldFill'
    default_name = 'fill'
    default_color = (1.0, 1.0, 1.0, 0.25)
    default_align = uiconst.TOALL
    default_state = uiconst.UI_DISABLED
    default_left = 0
    default_top = 0
    default_width = 0
    default_height = 0
    default_textureResPath = 'res:/uicore/texture/fill.dds'

    def ApplyAttributes(self, attributes):
        uicls.Sprite.ApplyAttributes(self, attributes)
        color = attributes.get('color', self.default_color)
        if (color is not None):
            self.SetRGB(*color)
        newStyle = uicore.newRendererEnabled
        if not newStyle:
            blue.resMan.SetUrgentResourceLoads(True)
            self.texture = trinity.TriTexture()
            self.texture.pixels = attributes.get('textureResPath', self.default_textureResPath)
            blue.resMan.SetUrgentResourceLoads(False)
        else:
            self.texturePrimary = trinity.Tr2Sprite2dTexture()
            self.texturePrimary.resPath = 'res:/uicore/texture/uitest/uitestfill.dds'




class Fill(OldFill):
    __guid__ = 'uicls.Fill'


